/*******************************************************************************
Paper: Does the Production Approach to Markup Estimation Match a Stylized Fact?
Description: Imports SNI-key data from Excel and saves a processed version
Author: Tove Forsbacka
Last Updated: 15 February 2026
*******************************************************************************/

* Setup and environment control 
clear
set more off
capture log close 

* Define path and load the data
*cd "PROJECT_PATH"
import excel "nyckel-sni2002-sni2007.xlsx", firstrow  sheet(Detaljgrupp (femsiffer))

destring SNI2002, gen(nSNI2002)
destring SNI2007, gen(nSNI2007)
drop SNI2002 SNI2007

rename nSNI2002 SNI2002_1
rename nSNI2007 SNI2007_1_new

bysort SNI2002_1 (BenämningSNI2007): gen dup = _n
drop if dup > 1
drop dup

keep SNI2002_1 SNI2007_1_new

* Saving the data
save "sni_key.dta", replace